from django.contrib import admin
from .models import Article, BookInfo, HeroInfo


class ArticleAdmin(admin.ModelAdmin):
    list_display = ["title", "content", "ub_date", "update_time"]
    list_filter = ["title"]
    search_fields = ["title"]
    list_per_page = 100


class HeroInfoInline(admin.TabularInline):
    model = HeroInfo
    extra = 1


class BookInfoAdmin(admin.ModelAdmin):
    list_display = ["btitle", "bpub_date"]
    list_per_page = 20
    list_filter = ["btitle"]
    search_fields = ["btitle"]
    inlines = [HeroInfoInline]


admin.site.register(Article, ArticleAdmin)
admin.site.register(BookInfo, BookInfoAdmin)